package com.fhz.oomtest

import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.os.Message

class MainActivity2 : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main2)


            //等十秒,内存泄漏完成.
            Thread.sleep(10000)
            //开始创建大量线程.造成内存溢出
            while(true){
                Thread{
                Thread.sleep(10000)
                }.start()
            }


    }

    override fun onDestroy() {
        super.onDestroy()
        println("2销毁了")

    }
}